package com.codedef.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.codedef.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper extends BaseMapper<User> {

    @Update("UPDATE `user` SET reservation_number = reservation_number + 1 WHERE id = #{userId}")
    int increaseReservationNumber(@Param("userId") Integer userId);

    @Update("UPDATE `user` SET default_number = default_number + 1 WHERE id = #{userId}")
    int increaseDefaultNumber(@Param("userId") Integer userId);

    @Select("SELECT NOW()")
    String testDbTime();

}
